Fix: Convert img tags to markdown to prevent '>' appearing in posts#131
Conversation
…attermost-community#70) When an image is attached in a Bitbucket issue description, the HTML contains <img> tags. Previously, these were stripped by doc.Text(), potentially leaving empty lines that would show as '>' blockquote characters in Mattermost posts after the quote function was applied. This fix converts <img> tags to markdown image syntax () before extracting text, ensuring images are properly displayed in Mattermost and preventing orphan '>' characters from appearing. - Added handling for img tags in replaceAllBitBucketUsernames function - Added test case for issues with image attachments - Added test fixture for issue with image content
|
Hello @Alearner12, Thanks for your pull request! A Core Committer will review your pull request soon. For code contributions, you can learn more about the review process here. Per the Mattermost Contribution Guide, we need to add you to the list of approved contributors for the Mattermost project. Please help complete the Mattermost contribution license agreement? This is a standard procedure for many open source projects. Please let us know if you have any questions. We are very happy to have you join our growing community! If you're not yet a member, please consider joining our Contributors community channel to meet other contributors and discuss new opportunities with the core team. |
|
/check-cla |
Summary
Fixes #70
When an image is attached in a Bitbucket issue description, the
>(blockquote) character was appearing in Mattermost posts.Problem
<img>HTML tags in issue/comment descriptionsreplaceAllBitBucketUsernamesfunction strips HTML tags usingdoc.Text()<img>tags would show>characters after thequotefunction was appliedSolution
Added handling for
<img>tags in thereplaceAllBitBucketUsernamesfunction that converts them to markdown image syntax () before text extraction. This ensures:>blockquote characters appear#Changes
server/templaterenderer/template.go- Added img tag to markdown conversionserver/templaterenderer/template_fixture_test.go- Added test fixture for issues with imagesserver/templaterenderer/issue_test.go- Added test case for image handlingTesting
RenderIssueCreatedEventNotificationForSubscribedChannels_WithImage